package cn.baiweigang.uu.enums;

public enum ExtKeyEnum {
    MA5_C("MA5_C", "c",5, "收盘价5均"),
    MA6_C("MA6_C", "c", 6,"收盘价6均"),
    MA10_C("MA10_C", "c", 10,"收盘价10均"),
    MA20_C("MA20_C", "c", 20,"收盘价20均"),
    MA5_E("MA5_E", "e",5, "成交额 5均"),
    MA10_E("MA10_E", "e",10, "成交额 10均"),
    MA20_E("MA20_E", "e", 20,"成交额 20均"),
    MA5_HS("MA5_HS", "hs", 5,"换手率 5均"),
    MA10_HS("MA10_HS", "hs", 10,"换手率 10均"),
    MA20_HS("MA20_HS", "hs", 20,"换手率 20均"),

    SUM3_ZD("SUM3_ZD", "zd", 3,"最近3天涨跌百分比 求和"),
    SUM5_ZD("SUM5_ZD", "zd", 5,"最近5天涨跌百分比 求和"),
    SUM20_ZD("SUM20_ZD", "zd", 20,"最近20天涨跌百分比 求和"),

    CHANGE1_PM("CHANGE1_PM", "pm", 2,"排名上升比率 (前一天排名-当天排名)/当天排名"),
    ;
    private String code;
    private String fieldName;
    private int size;
    private String desc;

    ExtKeyEnum(String code, String fieldName, int size, String desc) {
        this.code = code;
        this.fieldName = fieldName;
        this.size = size;
        this.desc = desc;
    }

    public static ExtKeyEnum getExtKeyEnumByCode(String code) {
        ExtKeyEnum[] periodEnums = values();
        for (int i = 0; i < periodEnums.length; i++) {
            if (code != null && code.equalsIgnoreCase(periodEnums[i].getCode())) {
                return periodEnums[i];
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getFieldName() {
        return fieldName;
    }

    public int getSize() {
        return size;
    }

    public String getDesc() {
        return desc;
    }
}
